<?php
/**
 * Holds class Enum
 *
 * @author daantimmer
 *
 * @package Library
 * @subpackage Enum
 */

/**
 * Basic class for creating Enumerated types.
 *
 * This version is an Enumerated type that can be used for bit-fields.
 * Each entry has its own bit value.
 * So values like 3 and 4 do not exist.
 * First entry starts with key = 1, next = 2, 4, 8, etc.
 *
 * This makes this version unique in the sence that you can combine values to form a collection.
 * 1+2 = 3, thus bit 1 and 2 are set. This is equivalent of the 'set'-type in MySql
 *
 * @author daantimmer
 */
class Enum_Flags extends Enum {
	public function __construct( /*...*/ ) {
		$args = func_get_args();
		for( $i=0, $n=count($args), $f=0x1; $i<$n; $i++, $f *= 0x2 )
			$this->{$args[$i]} = $f;
			//$this->add($args[$i], $f);
	}
}